package com.orcwar.gui.views;

import android.content.ClipData;
import android.content.ClipData.Item;
import android.content.ClipDescription;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.orcwar.enums.OWItemType;

public class OWItemSelectView extends TextView {

	public OWItemSelectView(Context context, OWItemType itemType) {
		super(context);
		setText(itemType.toString());

		setOnLongClickListener(new OnLongClickListener() {

			@Override
			public boolean onLongClick(View v) {
				// start dragging!
				Item item = new Item(((OWItemSelectView) v).getText());
				ClipData dragData = new ClipData(item.getText(),
						new String[] { ClipDescription.MIMETYPE_TEXT_PLAIN },
						item);

				v.startDrag(dragData, new DragShadowBuilder(v), null, 0);
				return true;
			}
		});
	}

	public OWItemSelectView(Context context) {
		super(context);
	}

}
